#include "log.h"
	
	
	
int logMessage(FILE* f, const char *string, ...){
	va_list ap;
	int r,st,ss;
	char* buff;
	char* times;
	time_t now = time (0);
	times = ctime(&now);
	ss = strlen(string);
	st = strlen(times);
	buff = (char*)malloc((ss+st+3)*sizeof(char));
	times[st-1] = '\0';
	sprintf(buff,"[%s] %s",times,string);
  	va_start(ap, string);
  	r = vfprintf (f,buff, ap);
  	va_end (ap);
	free(buff);
  	return r;
}



